#ifndef GL_UTILS_H
#define GL_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif

#include <GL/glew.h>
#include <SDL2/SDL.h>

typedef struct {
    GLuint fbo;
    GLuint tex;
    uint32_t w;
    uint32_t h;
} gl_fbo;

GLuint InitShader(const char *shaderSrc);
GLuint InitArrayBuffer(float *data, size_t size);
GLuint InitAttrArrayBuffer(GLuint program, float *data, size_t size, size_t num,
                           const char *attr);
void InitAttrBuffer(GLuint buffer, GLuint attr, size_t num);
GLuint InitTexture(GLuint program, SDL_Surface *sur, uint32_t texn,
                   const char *uni);
GLuint InitElementsBuffer(void *data, size_t size);

int InitFrameBuffer(gl_fbo *fbo, uint32_t w, uint32_t h);

#ifdef __cplusplus
}
#endif

#endif